package com.tfswx.jcyw.sqlmodel.api.bean.table;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;


@Data
public class UnionOperation implements SetOperation {

    private Boolean distinct;
    private Boolean all;
    private final String opration = "UNION";

    public UnionOperation(Boolean distinct, Boolean all) {
        this.distinct = distinct;
        this.all = all;
    }

    public UnionOperation() {
        this(false, false);
    }

    @Override
    public String toString() {
        String allDistinct = "";
        if (getAll()) {
            allDistinct = " ALL";
        } else if (getDistinct()) {
            allDistinct = " DISTINCT";
        }
        return opration + allDistinct;
    }
}
